package com.demos.springcloud.consumer03HystrixFallback.service;

import com.demos.springcloud.consumer03HystrixFallback.service.fallbackImp.InterfaceFallbackServiceImp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.Map;

/**
 * 通过feign定义的接口，实现降级方法解耦
 */
@Component
@FeignClient(name = "gatewayRoute", fallback = InterfaceFallbackServiceImp.class)
public interface InterfaceFallbackService {

    @PostMapping("exp/post/{id}")
    Map<String, Object> expPost(@PathVariable(name = "id") String id);

    @GetMapping("exp/timeout")
    String expGetTO();
}
